<template>
    <div v-if="detailsVisible" style="display: flex;">
        <div class="leftitem">
            <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
                <el-menu-item :index="index"  v-for="(itemc,index) in threeKeys" :key="index" >{{itemc.name}}</el-menu-item>
            </el-menu>
        </div>
        <div class="rightitem">
            <el-collapse v-model="activeNames"  accordion>
                <el-collapse-item  name="1">
                    <template slot="title">{{typeB}} 历次记录<i class="header-icon el-icon-info" style="margin-left: 10px;"></i></template>
                    <lcjl ref="lcjl" v-on:serchrecorde="serchrecorde" v-on:serchfile="dbFilerecode"></lcjl>
                </el-collapse-item>
                <el-collapse-item  name="2" class="huanjiexuanju_file" v-show="disabledTwo"> 
                    <template slot="title">
                    {{typeB}} 相关文件
                        <Badge dot v-if="hasnewfile==true">
                            <Icon type="ios-albums"  style="margin-left: 10px;"></Icon>
                        </Badge>
                        <Icon type="ios-albums"  style="margin-left: 10px;" v-if="hasnewfile==false"></Icon>
                    </template>
                    <showfiles ref="showfiles"></showfiles>
                </el-collapse-item>
            </el-collapse>
        </div>
    </div>
</template>
<script>
    import Common from "../../../js/Common.js";
    import {mapActions} from 'vuex';
    export default {
        data: () => ({
            detailsVisible:false,
            activeIndex:'',
            activeNames:'1',
            disabledTwo:false,
            typeA:'',
            typeB:'',
            hasnewfile:false,
            Tabs:[],
            showAdd:false,//显示添加的按钮,  //只有党支部才可以显示添加
            showallFileds:false,//显示所有列
            threeKeys:[],

        }),
        watch: {
            "detailsVisible": {
                handler(n) {
                    if(this.detailsVisible==true)
                    {
                        let _this=this;
                        //1 去后台获取当前dwid dzbid的在当前的tabs（）222
                        //获取第三集的tab
                        
                    }
                },
                deep: true
            }, 
            "filerecordes": {
                handler(n) {
                    if(this.filerecordes.length>0){
                    }
                    else
                    {
                        this. disabledTwo=false;
                    }
                },
                deep: true
            }, 

        },
        mounted() {
            Common.Config.this = this;
            if (this.GetUser() == false) {
                this.$router.push("/");
            }
        },
        components: {
        },
        methods: {
            ...mapActions(['GetUser', 'GetTabs']),
            handleSelect(key)
            {
                this.activeIndex=key;
                this.GetTabs(this.typeA+'-'+this.typeB)
                .then(function(value){
                    _this.Tabs=value.Ltabs;
                })
                setTimeout(function () {
                    _this.$refs.lcjl.$data.typeA=_this.typeA;
                    _this.$refs.lcjl.$data.typeB=_this.typeB+'-'+_this.activeIndex;
                    _this.$refs.lcjl.$data.samedwdzb=false;
                }, 100)
            },
            showallFiledsF(){
                this.showallFileds=!this.showallFileds;
            },
            serchrecorde(data){
                this.filerecordes=data;
            },
            dbFilerecode(data){
                this.disabledTwo=true;
                this.activeNames='2';
                this.$refs.showfiles.$data.Filerecode=data;
                this.$refs.showfiles.$data.Tabs=this.Tabs;
                this.$refs.showfiles.$data.columns={
                    normal:
                    [
                        {
                            prop:'time',
                            width:'155',
                            label:'来文时间',
                        },
                        {
                            prop:'bianhao',
                            width:'155',
                            label:'文件编号',
                        },
                        {
                            prop:'name',
                            width:'155',
                            label:'文件名称',
                        },
                        {
                            prop:'status',
                            width:'155',
                            label:'办理状态',
                        },
                        {
                            prop:'jieguo',
                            width:'155',
                            label:'办理结果',
                        },
                        {
                            prop:'store',
                            width:'125',
                            label:'实际存放',
                        },
                    ],
                    showcontent:{
                        show:true,
                        prop:'content',
                        width:'125',
                        label:'内容查看',
                    },
                    showdownload:{
                        show:true,
                        prop:'truesrc',
                        width:'125',
                        label:'内容下载',
                    }
                }
            },
        }
    }
</script>
<style>
</style>



<template>
    <div v-if="detailsVisible">
        <el-collapse v-model="activeNames"  accordion>
            <el-collapse-item  name="1">
                <template slot="title">{{typeB}} 历次记录2<i class="header-icon el-icon-info" style="margin-left: 10px;"></i></template>
                <lcjl ref="lcjl" v-on:serchrecorde="serchrecorde" v-on:serchfile="dbFilerecode"></lcjl>
            </el-collapse-item>
            <el-collapse-item  name="2" class="huanjiexuanju_file" v-show="disabledTwo"> 
                <template slot="title">
                  {{typeB}} 相关文件2
                    <Badge dot v-if="hasnewfile==true">
                        <Icon type="ios-albums"  style="margin-left: 10px;"></Icon>
                    </Badge>
                    <Icon type="ios-albums"  style="margin-left: 10px;" v-if="hasnewfile==false"></Icon>
                </template>
                <showfiles ref="showfiles"></showfiles>
            </el-collapse-item>
        </el-collapse>
    </div>
</template>
<script>
    import Common from "../../../js/Common.js";
    import {mapActions} from 'vuex';
    export default {
        data: () => ({
            detailsVisible:true,
            activeNames:'1',
            disabledTwo:false,
            typeA:'',
            typeB:'',
            hasnewfile:false,
            Tabs:[],
        }),
        watch: {
            "detailsVisible": {
                handler(n) {
                    if(this.detailsVisible==true)
                    {
                        //1 去后台获取当前dwid dzbid的配置信息文件3333



                        //2 判断是否需要二级界面



                        //3

                        this.$refs.lcjl.$data.typeA=this.typeA;
                        this.$refs.lcjl.$data.typeB=this.typeB;
                    }
                },
                deep: true
            }, 
            "filerecordes": {
                handler(n) {
                    if(this.filerecordes.length>0){
                    }
                    else
                    {
                        this. disabledTwo=false;
                    }
                },
                deep: true
            }, 

        },
        methods: {
            serchrecorde(data){
                this.filerecordes=data;
            },
            dbFilerecode(data){
                this.disabledTwo=true;
                this.activeNames='2';
                this.$refs.showfiles.$data.Filerecode=data;
                this.$refs.showfiles.$data.Tabs=[
                    {title: '上级文件'},
                    {title: '请示'},
                    {title: '批复'},
                    {title: '方案'},
                    {title: '工作报告'},
                    {title: '总结汇报'},
                    {title: '新建'}
                ];

                this.$refs.showfiles.$data.columns={
                    normal:
                    [
                        {
                            prop:'time',
                            width:'155',
                            label:'来文时间',
                        },
                        {
                            prop:'bianhao',
                            width:'155',
                            label:'文件编号',
                        },
                        {
                            prop:'name',
                            width:'155',
                            label:'文件名称',
                        },
                        {
                            prop:'status',
                            width:'155',
                            label:'办理状态',
                        },
                        {
                            prop:'jieguo',
                            width:'155',
                            label:'办理结果',
                        },
                        {
                            prop:'store',
                            width:'125',
                            label:'实际存放',
                        },
                    ],
                    showcontent:{
                        show:true,
                        prop:'content',
                        width:'125',
                        label:'内容查看',
                    },
                    showdownload:{
                        show:true,
                        prop:'truesrc',
                        width:'125',
                        label:'内容下载',
                    }
                }
            },
        }
    }
</script>
<style>
</style>